package com.hystrix.example.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @GetMapping("demo")
    @HystrixCommand(fallbackMethod = "hystrix_demo")
    public String getDemo() {
        if (1 == 1) {
            throw new RuntimeException();
        }
        return "demo";
    }

    public String hystrix_demo(){
        return "hystrix_demo";
    }
}
